//
//  XS_VIPCourseItemCell.swift
//  XueDao
//
//  Created by Mac on 2021/1/15.
//

import UIKit

class XS_VIPCourseItemCell: UICollectionViewCell {
    
    var _model : XS_VIPCourseModel!
    public var model : XS_VIPCourseModel!{
        set{
            _model = newValue
            //设置数据
            imgView.sd_setImage(with: URL.init(string: newValue.curriculumImgUrl), completed: nil)
            titleLabel.text = newValue.curriculumName
            numberLabel.text = newValue.purchaseNum+"人加入学习"
            
            let (p, _) = xsGetPrice(vipIsFree: newValue.vipIsFree, isFree: newValue.isFree, vipPrice: newValue.vipPrice, discountPrice: newValue.discountPrice, price: newValue.price)
            
            priceLabel.text = "共\(newValue.curriculumNum)节 | " + (p.count > 0 ? "￥\(p)" : "免费")
        }
        get{
            return _model
        }
    }

    @IBOutlet weak var imgView: UIImageView!
    @IBOutlet weak var titleLabel: UILabel!
    @IBOutlet weak var numberLabel: UILabel!
    @IBOutlet weak var priceLabel: UILabel!
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
        layer.cornerRadius = 4
        clipsToBounds = true
    }

}
